<cfcomponent name="groupsService" output="false">

	<cffunction name="init" access="public" output="false" returntype="trac_fu.model.groups.groupsService">
		<cfargument name="groupsDAO" type="trac_fu.model.groups.groupsDAO" required="true" />
		<cfargument name="groupsGateway" type="trac_fu.model.groups.groupsGateway" required="true" />

		<cfset variables.groupsDAO = arguments.groupsDAO />
		<cfset variables.groupsGateway = arguments.groupsGateway />

		<cfreturn this/>
	</cffunction>

	<cffunction name="getgroups" access="public" output="false" returntype="groups">
		<cfargument name="id" type="string" required="true" />
		
		<cfset var groups = createObject("component","trac_fu.model.groups.groups").init(argumentCollection=arguments) />
		<cfreturn variables.groupsDAO.read(groups) />
	</cffunction>

	<cffunction name="getgroupss" access="public" output="false" returntype="query">
		<cfargument name="id" type="string" required="false" />
		<cfargument name="name" type="string" required="false" />
		
		<cfreturn variables.groupsGateway.getByAttributes(argumentCollection=arguments) />
	</cffunction>

	<cffunction name="savegroups" access="public" output="false" returntype="boolean">
		<cfargument name="id" type="string" required="true" />
		<cfargument name="name" type="string" required="true" />
		
		
		<cfset var groups = getgroups(arguments.id) />
		<cfset groups.setid(arguments.id) />
		<cfset groups.setname(arguments.name) />
		<cfreturn variables.groupsDAO.save(arguments.groups) />
	</cffunction>

	<cffunction name="deletegroups" access="public" output="false" returntype="boolean">
		<cfargument name="id" type="string" required="true" />
		
		<cfset var groups = createObject("component","trac_fu.model.groups.groups").init(argumentCollection=arguments) />
		<cfreturn variables.groupsDAO.delete(groups) />
	</cffunction>
</cfcomponent>